<?php
include './config/config.php'; 
include './phpqrcode/phpqrcode.php'; 

/**
 * 生成临时二维码图片
 * @param string $data 二维码内容
 * @return
*/
function create_qrcode($data)
{
    $QRcode = new \QRcode();
    $level = 'L';        //容错级别
    $size = 5;           //生成图片大小
    // header函数输出了  png头
    //ob_start();    
    $QRcode->png($data, false, $level, $size, 2);
    //$base64 = base64_encode(ob_get_contents());
    //ob_end_clean();

    //return "data:image/jpg;base64,". $base64;
}

$query = http_build_query(array('guid' => $_GET['guid']));

$url = $config['local']['baseurl'] . ':'. $config['local']['port']. '/broadcast.php?' . $query;

$data = create_qrcode($url);

?>



